programming4us
           
 
 
Programming

iOS SDK : Debugging (part1 )

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
8/17/2011 11:31:44 AM
Debugging and testing your application is paramount if you wish to provide users with a robust application. Xcode provides several excellent tools for debugging and testing your applications. In this section, you explore basic debugging using Xcode’s graphical front end to the GNU debugger.

Note

For a more complete introduction to debugging, refer to Apple’s “Xcode Debugging Guide,” available online.


Using the Debugger

Xcode’s visual debugger makes it easy to step through the execution of your app, examine variable values, etc. When you select View | Navigators | Debugger from the main menu, you’ll see the debugger’s panes (Figure 1). The left (navigation) pane shows the app’s threads and the call stack for each. This tells you where your application is currently at in any point in the application’s processing. The main pane on the right is the Text Editor pane, which displays the source code for the method, lets you set/remove breakpoints, and also permits you to view the values of variables by hovering over them. If you select View | Show Debugger Area from the main menu, you’ll see the debugger area at the bottom of the window. This pane lets you control execution of your app, see/edit the current function’s variable values, and view the contents of the console (log file).

Figure 1. The debugger window

Along the top of the debugger area, notice the buttons that control the debugger. From left to right, they are Continue, Step Over, Step Into, and Step Out. To the right of them you’ll see the current stack. Table 1 summarizes each button’s purpose.

Table 1. Debugger Area Buttons
ButtonFunction
Pause/ContinuePauses the application running in the debugger. Note, when the application is paused, this button says Continue. Continue “un-pauses” the application and resumes processing.
Step OverProcesses the next line of code. If the next line is a function call, it executes the function, proceeding to the next line.
Step IntoProcesses the next line of code. If the line is a function call, it jumps to the code inside the function.
Step OutProcesses until the current function exits and stops in the function that called it.

Breakpoints

Breakpoints tell the debugger where to pause. If you set no breakpoints and then run the application in the debugger, nothing unusual happens, as you didn’t tell the application to pause. There are several ways to set a breakpoint, but the easiest is to click in the Editor window’s gutter next to the line of code you wish the debugger to stop at (Figure 2). If you wish to disable the breakpoint, click it again and it turns light blue, indicating it is disabled. If you wish to remove the breakpoint, CTRL-click and select Remove Breakpoint from the pop-up menu. Alternatively, you can drag the breakpoint off the gutter to remove it. When you run the application in the debugger, it will pause processing at the first encountered breakpoint.

Figure 2. Setting a breakpoint

Stepping Through Code

When an application pauses at a breakpoint, you can step through your code’s execution. Step Over moves directly to the next line, executing any function and stopping on the next line. Step Into also moves to the next line, but if the next line is a function, it jumps to the function’s first line, and you can either step through the function line by line or step out of the function. If you choose Step Out, the debugger jumps to the first line after the function call.

Debugger Datatips

One thing you can do while debugging is obtain a variable’s value and modify it while debugging. You can move your cursor over the variable in the source code, and a datatip appears with the variable and its value (Figure 3). You can even modify the value if desired.

Figure 3. The Debugger datatips
Other -----------------
- iOS SDK : Installing Applications on an iPhone
- Software Testing with Visual Studio Team System 2008 : Web Testing - Recording a test
- Software Testing with Visual Studio Team System 2008 : Unit testing web services & Code coverage unit test
- .NET Debugging : Introduction to the Tools - SOS & SOSEX
- .NET Debugging : CLR 4.0 - Synchronization & Interoperability
- iPhone Programming : Connecting to the Network - Getting Data from the Internet
- iPhone Programming : Connecting to the Network - Sending Email
- Programming Excel with VBA and .NET : Tasks in Visual Basic - Check Results
- Programming Excel with VBA and .NET : Tasks in Visual Basic - Read and Write Files
- Programming Excel with VBA and .NET : Tasks in Visual Basic - Get Dates and Times
- Programming Excel with VBA and .NET : Tasks in Visual Basic - Work with Text
- A Technical Overview of the Mobile Web : THE TECHNICAL CHALLENGES OF MOBILE DEVICES (part 2)
- A Technical Overview of the Mobile Web : THE TECHNICAL CHALLENGES OF MOBILE DEVICES (part 1) - Physical Constraints
- Parallel Programming with Microsoft Visual Studio 2010 : Task Parallelism - Unhandled Exceptions in Tasks
- Parallel Programming with Microsoft Visual Studio 2010 : Introduction to Parallel Tasks
- jQuery 1.3 : DOM Manipulation - Moving elements
- .NET Debugging : Introduction to the Tools - .NET 2.0—Redistributable & .NET 2.0—SDK
- .NET Debugging : Managed Heap and Garbage Collection
- Context and Interception : Custom Component Services (part 3) - The Transaction Management Service
- Context and Interception : Custom Component Services (part 2) - The Logbook Service
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us